﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ideas2Realize.CommonInterfaces;
using Ideas2Realize.Data.Business.Interface;
using System.Security.Principal;
using StructureMap;
using System.Threading;

namespace Ideas2Realize.Data.Business.Services
{
    public class AuthorizationService : IAuthorizationService
    {
        IUserRepository _repository;

        public AuthorizationService(IUserRepository repo)
        {
            _repository = repo;
        }

        public bool Login(string username, string password)
        {
            var user = _repository.AuthenticateUser(username, password);

            if (user == null)
                throw new Exception("Wrong username or password.");

            return true; 
        }
    }
}
